package io.gitee.wminyu.day02;

import java.util.Scanner;

public class hasContinuousFour {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int m = input.nextInt();
        int arrays[] = new int[m];
        for (int i=0;i<m;i++){
            arrays[i] = input.nextInt();
        }
        System.out.println(hasContinuousFour(arrays,m));
    }
    public static boolean hasContinuousFour(int[] numbers,int n){
        int count=0;
        for (int i=0;i<n-1;i++){
            if (numbers[i]==numbers[i+1]){
                  count++;
                  System.out.println(numbers[i]);
                  continue;

            }
            if (count==3){
                System.out.println(count);
                return true;
            }
        }
        return false;
    }
}
